/**
 * 新闻详情-主要给IOS和安卓分享使用 http://192.168.0.152:8080/lifetime/bluehired/newsdetails.html?id=26
 * @author  Jello
 * @create  2018/10/24 19:45
 * @version 1.0
 * @company 广东蓝聘科技网络有限公司
 **/
var spinner = new Spinner(opts);

$(function() {
	var newId = getParam('id'); //截取Android、IOS中href的id参数
	//根据当前id查询新闻详情
	$.ajax({
		type: "get",
		url: serverUrl + "/essay/get_essay?id=" + newId,
		cache: false,
		async: false,
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		crossDomain: true,
		timeout: 15000,
		beforeSend: function() {
			$("#myspin").text("");
			var target = $("#myspin").get(0);
			spinner.spin(target);
		},
		success: function(data) {
			closeSpin(300);
			var resultObj = eval(data);
			if(resultObj.code == 0) {
				if(resultObj.data != null) {
					$("#new1").html(resultObj.data.essayName);
					$("#new_author").html(resultObj.data.essayAuthor);
					$("#tiem_tiem").html(timeFormat(resultObj.data.time));
					$("#new3").html(resultObj.data.essayDetails);
				} else {
					mui.toast("新闻详情内容为空");
				}
			} else {
				mui.toast(resultObj.msg);
				return;
			}
		},
		error: function(XMLHttpRequest, status, errorThrown) {
			closeSpin(300);
			if(status == 'timeout') {
				mui.toast("请求超时");
			} else {
				mui.toast("请求网络服务数据失败");
			}
			return;
		}
	});
})